<?php
namespace app\admin\validate;

use think\Validate;

/**
* 
*/
class Library extends Validate
{
   protected $rule = [
        'name'       => 'require',
		'label_library_type_id' => 'require'
    ];
    
    protected $message = [
        'name.require'       => '请填写名称',
		'label_library_type_id.require'       => '请选择类别'
    ];
    protected $scene = [
        //编辑场景
        'edit'  => [
        	'name'       => 'require',
			'label_library_type_id' => 'require'
        ],
    ];

	/**
	*自定义验证 
	* 手机号格式检查
	* @param string $mobile
	* @return bool
	*/
	protected function check_mobile_number($mobile)
	{
	    if (!is_numeric($mobile)) {
	        return false;
	    }
	    $reg = '#^13[\d]{9}$|^14[5,7]{1}\d{8}$|^15[^4]{1}\d{8}$|^17[0,6,7,8]{1}\d{8}$|^18[\d]{9}$#';

	    return preg_match($reg, $mobile) ? true : false;
	}


}